package humanMirror.model.questionLibrary;

import java.sql.SQLException;

public class QuestionLibrary {
	SqlWorkerInterfase worker;

	public QuestionLibrary(SqlWorkerInterfase worker) {
		this.worker = worker;
	}

	public QuestionInfo getQuestion(int numberOfQuestion) {

		try {
			QuestionInfo resultQuestion = new QuestionInfo(worker,
					worker.getQuestion(numberOfQuestion), numberOfQuestion,
					worker.getAnswers(numberOfQuestion));

			return resultQuestion;
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}

	public int getCountOfQuestions() {
		int result = 0;
		try {
			result = worker.getCountOfQuestions();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return result;
	}

	public void disconnect() {
		try {
			worker.disconnect();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
